import service from "@/utils/request"
import LoginWork from "@/utils/LoginWork"

// 查询未收参数
export interface ExampleQueryUnreceivedParameters{
    dateEnd:string,
    dateStart:string,
    mtlColor:string,
    mtlName:string,
    pageNum:number,
    pageSize:number,
    purLot:string,
    purNo:string,
    purStyle:string,
    typeNo:string,
    vendorName:string
    allFlag:number
}

export interface QueryNotReceivedInterface {
    total?: number,
    unsentSum: number,
    dtos: dtos[],
    qtySum: number,
}

export interface dtos{
    purNo: null,
    vendorName: null,
    purLot: string,
    purStyle: string,
    purColor: string,
    ordQty: null,
    mtlColor: null,
    mtlName: string,
    mtlSpec: string,
    mtlUnit: string,
    qty: number,
    overQty: null,
    minusQty: null,
    sendQty: null,
    unSendQty: number
    PUR_TYPE:string,
    change:string
}

// 查询未收 接口数据
export const QueryNotReceived = (parms:ExampleQueryUnreceivedParameters) => {
    return service.put<any,QueryNotReceivedInterface>('/pcFactorStockQuery/getPurSpUnSentQuery',parms)
}

// 查询未收参数参数
export interface ExampleQueryUnreceivedParametersAll{
    dateEnd:string,
    dateStart:string,
    mtlColor:string,
    mtlName:string,
    pageNum:number,
    pageSize:number,
    purLot:string,
    purNo:string,
    purStyle:string,
    typeNo:string,
    vendorName:string
    allFlag:number
}


export interface QueryNotReceivedInterfaceAll{
    total?: number,
    unSendSum: number,
    dtos: dtos[],
    qtySum: number
    sendSum:number
}

export interface AllDtos{
    code: number
    data: QueryNotReceivedInterfaceAll 
    message: string
}

// 查询已收
export const QueryReceived = (parms:ExampleQueryUnreceivedParameters) => {
    return LoginWork.put<any,any>('/pcFactorStockQuery/getPurSpSentQuery',parms)
}

// 入库批 处理
export const StorageBatchProcessing = (parms:any) => {
    return LoginWork.put<any,any>(`/pcFactorStockQuery/purPutSpStockUpdate`,parms)
}

// 新增暂收作业参数
export interface AddedTemporaryJobParameters{
    purNo:string
    purLot:string
    mtlColor:string
    mtlName:string
    sendQty:string
    vendorName:string
    sendNo:string
}

export interface AddedTemporaryJobParametersTleA{
    list:AddedTemporaryJobParameters[]
}

// 新增暂收作业
export const AddedATemporaryJob = (parms:AddedTemporaryJobParametersTleA,vendorName:string,sendNo:string) => {
    return LoginWork.put<any,any>('/pcFactorStockQuery/purSpSentAdd',parms,{
        params:{vendorNo:vendorName,sendNo:sendNo}
    }
    )
}

// 厂商数据
export const VendorData = () => {
    return service.get<any,any>('/pcFactorStockQuery/purSpStockBack')
}

export interface MaterialSuspenseInterface {
    head:headP[]
    user:user[]
}
export interface headP{
    typeNo: string,
    typeName: string
}

export interface user {
    typeNo: string,
    typeName: string
}

// 分类定义
export const MaterialSuspense = () => {
    return service.put<any,MaterialSuspenseInterface>('/pcFactorStockQuery/sentSpMtlTypeQuery')
}

// 分类定义 增删
export const MaterialAdditionAndDeletion = (parms:any,flag:any) => {
    return LoginWork.put<any,any>('/pcFactorStockQuery/sentSpMtlTypeAdd',parms,{
        params:{flag:flag}
    })
}

export const PutIntoStorage = (recNo:string) => {
    return LoginWork.get<any,any>('/pcFactorStockQuery/purSpStockUpdate',{
        params:{recNo:recNo}
    })
}